#ifndef ARTEFACT_H
#define ARTEFACT_H
#include <QString>
#include <QtXml/QDomDocument>

#include "IA_lib_global.h"
#include "position.h"

namespace IAlib
{
    class IA_LIBSHARED_EXPORT Artefact
    {
    public:
        enum ArtefactType
        {
            ArtefactType_COM,
            ArtefactType_TRANSPORT,
            ArtefactType_INFO,
            ArtefactType_OTHER
        };

        enum ArtefactState
        {
            ArtefactState_AVAILABLE,
            ArtefactState_UNAVAILABLE,
            ArtefactState_UNKNOWN,
            ArtefactState_UNUSABLE
        };
        Artefact(const QString id);
        Artefact(const Artefact& artefact);

        void setID( const QString& id ) {m_id = id;}
        QString getID() const {return m_id;}

        void setOwnerId(const QString& id) { m_owner_id = id; }
        QString getOwnerId() const { return m_owner_id; }

        void setArtefactType(const ArtefactType type) { m_type = type;}
        ArtefactType getArtefactType() const {return m_type;}

        void setClass(const QString&  _class) {m_class = _class;}
        QString getClass() const {return m_class;}

        void setArtefactState(const ArtefactState state) { m_state = state;}
        ArtefactState getArtefactState() const {return m_state;}

        void setExclusive(const bool status) { m_exclusive = status; }
        bool isExclusive() const {return m_exclusive;}

        void setTransportable(const bool status) { m_transportable = status; }
        bool isTransportable() const {return m_transportable;}

        void setMaxSlot(const int nb_slot) { m_max_slot = nb_slot; }
        int getMaxSlot() const { return m_max_slot; }

        void setPosition(const Position& position) { m_position = position; }
        void setPosition(const float x, const float y, const float z, const QString& work_space_id);
        Position getPosition() const { return m_position; }

        QDomElement toXML(QDomDocument &doc);
        void        fromXML(QDomElement ele);

    protected:
        QString       m_id;
        QString       m_owner_id;
        ArtefactType  m_type;
        QString       m_class;
        ArtefactState m_state;
        bool          m_transportable;
        bool          m_exclusive;
        int           m_max_slot;
        Position      m_position;
    };
}

#endif // ARTEFACT_H
